import request from "@/utils/request";

export interface StallQuery extends PageQuery {
  page?: number;
  limit?: number;
  keywords?: string;
  shop_id?: number;
}

export interface StallDetail {
  id: number;
  title: number;
  shop_id: string;
  status: number;
}

export interface StallForm {
  id?: number;
  title?: string;
  shop_id?: number;
  status?: number;
}

const baseUri = "/mv1/api/stall";

export function getStallList(query: StallQuery) {
  return request({
    url: baseUri + "/",
    method: "get",
    params: query,
  });
}

export function getStallDetail(id: number) {
  return request({
    url: baseUri + "/detail/" + id,
    method: "get",
    // params: {id},
  });
}

export function createStall(data: StallForm) {
  return request({
    url: baseUri + "/edit",
    method: "post",
    data: data,
  });
}

export function updateStall(id: number, data: StallForm) {
  return request({
    url: baseUri + "/edit/" + id,
    method: "put",
    data: data,
  });
}

export function deleteStall(id: number) {
  return request({
    url: baseUri + "/" + id,
    method: "delete",
  });
}
